package com.ruoqing.user.service.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoqing.core.domain.rquser.UserEntity;
import com.ruoqing.core.dto.BaseResponse;
import com.ruoqing.core.dto.user.UserResponse;
import com.ruoqing.core.enums.UserQueryEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
	* @author YaoXian
	* @title: UserService
	* @projectName ruoxi-blog
	* @description: 若兮微服务 - 用户服务 - 用户基础操作接口(可RPC远程调用)
	* @date 2020-11-03 17:24
	*/
@RequestMapping(path = "/userHandleService")
@Api(tags = "用户服务对内RPC调用 - 用户基础操作接口")
public interface UserService {
		
		/**
			* 根据查询条件精确查询用户
			* @param queryParam
			* @param userQueryEnum
			* @return UserEntity
			*/
		@ApiOperation(value = "根据查询条件精确查询用户", httpMethod = "GET")
		@GetMapping(path = "/findUserByCondition")
		@ApiImplicitParams(value = {@ApiImplicitParam(name = "queryParam", value = "精确查询条件"
						, required = true, dataType = "String"),@ApiImplicitParam(name = "userQueryEnum", value = "精确查询类型(枚举)"
						, required = true, dataType = "UserQueryEnum")})
		UserEntity findUserByCondition(@RequestParam("queryParam")String queryParam,@RequestParam("userQueryEnum") UserQueryEnum userQueryEnum);
		
		/**
			*  查询所有用户
			* @return List<UserEntity>
			*/
		@ApiOperation(value = "查询所有用户", httpMethod = "GET")
		@GetMapping(path = "/findAllUsers")
		List<UserEntity> findAllUsers();
		
		/**
			* 根据Id删除用户
			* @param userId 用户Id
			* @return UserResponse
			*/
		@ApiOperation(value = "根据ID删除用户", httpMethod = "DELETE")
		@DeleteMapping(path = "/deleteUserById")
		@ApiImplicitParam(name = "userId", value = "用户ID"
						, required = true, dataType = "Integer")
		UserResponse deleteUserById(@RequestParam("userId") Integer userId);
		
		/**
			*  修改用户信息
			* @param userEntity
			* @return String
			*/
		@ApiOperation(value = "修改用户信息", httpMethod = "POST")
		@PostMapping(path = "/updateUser")
		@ApiImplicitParam(name = "userEntity", value = "用户Dto数据传输对象"
						, required = true, dataType = "UserEntity")
		UserResponse updateUser(@RequestBody UserEntity userEntity);
		
		/**
			* 根据用户ID查询用户信息
			* @param userId
			* @return UserEntity
			*/
		@ApiOperation(value = "根据用户ID查询用户信息", httpMethod = "GET")
		@GetMapping(path = "/findUserById")
		@ApiImplicitParam(name = "userId", value = "用户ID"
						, required = true, dataType = "int")
		UserEntity findUserById(@RequestParam("userId") int userId);
		
		/**
			*  根据条件模糊查询用户
			* @param queryParam
			* @param condition
			* @return List<UserEntity>
			*/
		@ApiOperation(value = "根据条件模糊查询用户", httpMethod = "GET")
		@GetMapping(path = "/blurSelectUsers")
		@ApiImplicitParams(value = {@ApiImplicitParam(name = "queryParam", value = "模糊查询条件"
						, required = true, dataType = "String"),@ApiImplicitParam(name = "condition", value = "模糊查询类型"
						, required = true, dataType = "int")})
		List<UserEntity> blurSelectUsers(@RequestParam("queryParam") String queryParam,@RequestParam("condition")int condition);
		
		/**
			*  分页查询用户信息
			* @param currentPage
			* @param pageSize
			* @return Page<UserEntity>
			*/
		@ApiOperation(value = "分页查询用户信息", httpMethod = "GET")
		@GetMapping(path = "/selectUserByPagination")
		@ApiImplicitParams(value = {@ApiImplicitParam(name = "currentPage", value = "当前页"
						, required = true, dataType = "Integer"),@ApiImplicitParam(name = "pageSize", value = "每页显示条数"
						, required = true, dataType = "Integer")})
		Page<UserEntity> selectUserByPagination(@RequestParam("currentPage")Integer currentPage,@RequestParam("pageSize")Integer pageSize);
		
		/**
			* 根据条件查询用户并删除该用户
			* @param queryParam
			* @param userQueryEnum
			* @return BaseResponse
			*/
		@ApiOperation(value = "根据条件查询用户并删除该用户", httpMethod = "DELETE")
		@DeleteMapping(path = "/deleteUserBySelect")
		@ApiImplicitParams(value = {@ApiImplicitParam(name = "queryParam", value = "精确查询条件"
						, required = true, dataType = "String"),@ApiImplicitParam(name = "userQueryEnum", value = "精确查询类型(枚举)"
						, required = true, dataType = "UserQueryEnum")})
		BaseResponse deleteUserBySelect(@RequestParam("queryParam")String queryParam,@RequestParam("userQueryEnum") UserQueryEnum userQueryEnum);
		
		/**
			* 添加用户
			* @param userEntity
			* @return BaseResponse
			*/
		@ApiOperation(value = "添加用户", httpMethod = "PUT")
		@PutMapping(path = "/addUser")
		@ApiImplicitParam(name = "userEntity", value = "用户Dto数据传输对象"
						, required = true, dataType = "UserEntity")
		BaseResponse addUser(@RequestBody UserEntity userEntity);
}
